/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commande;
import entity.Produit;
/**
 *
 * @author livetnediser
 */
public class CommandItem {
    
    Produit product;
    int quantity;
    double price;
    double total;
    String name;

    public CommandItem(Produit product, double price, int quantity) {
        this.product = product;
        this.quantity = quantity;
        this.price = price;
        this.total = this.price* this.quantity;
        this.total = Math.rint(this.total*100)/100;
    }

    public Produit getProduct() {
        return product;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
        //Math.rint(numero*100)/100;
        this.total = this.price* this.quantity;
        this.total = Math.rint(this.total*100)/100;
    }

    public double getTotal() {
        return this.total;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
        this.total = this.price* this.quantity;
        this.total = Math.rint(this.total*100)/100;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

